<template>
  <div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="个人信息" key="1">
        <stu-info :studentData="studentData"></stu-info>
      </a-tab-pane>
      <a-tab-pane tab="个人简历" key="3">
        <stu-resume  :resumeList="resumeList"/>
      </a-tab-pane>
      <a-tab-pane tab="社会关系" key="4">
        <stu-relation :familyList="familyList"/>
      </a-tab-pane>
    </a-tabs>
    <a-form :form="form">
      <a-row>
        <a-form-item
          label="审核结果"
          style="width:150px;"
        >
          <a-select style="width:150px;" v-decorator="[
            'statusCode',
            {
              initialValue: '02',
              rules: [{ required: true, message: '请选择审核状态!' }],
            }
          ]">
            <a-select-option value="02">审核通过</a-select-option>
            <a-select-option value="03">审核不通过</a-select-option>
          </a-select>
        </a-form-item>
      </a-row>
      <a-form-item label="审核备注">
        <a-input type="textarea" style="width:100%;" v-decorator="['explain']" :autosize="{ minRows: 2, maxRows: 10 }"/>
      </a-form-item>
      <!-- <a-row style="text-align:center;margin:30px;">
        <a-button type="primary" @click="audit">审核</a-button>
      </a-row> -->
      <div class="ant-pro-footer-toolbar">
        <div style="float: right;margin-bottom: 10px;">
          <a-button style="margin-right: 10px;"  @click="back">返回列表</a-button>
          <a-button style="margin-right: 10px;"  @click="audit" type="primary">提交审核</a-button>
        </div>

      </div>
    </a-form>
    <!-- <div>
      审核结果
      <a-select v-model="post.shzt" allowClear style="width:150px;">
        <a-select-option v-for="i in TYPE0124" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
      </a-select>
    </div>
    <div>
      备注<a-input type="textarea" />
    </div>
    <a-row style="text-align:center;margin:30px;">
      <a-button type="primary">审核</a-button>
    </a-row> -->
  </div>
</template>

<script>
import stuInfo from './stuInfo'
import stuRelation from './stuRelation'
import stuResume from './stuResume'
import { mapState } from 'vuex'

export default {
  props: ['xh'],
  components: {
    stuInfo,
    stuRelation,
    stuResume
  },
  data () {
    return {
      post: {},
      studentData: {xjxx: {}},
      familyList: [],
      resumeList: [],
    }
  },
  watch: {
    xh: {
      handler (val) {
        if (val) {
          this.$api.student.stuXjInfo(val).then(res => {
            this.studentData = res.data
          })
          this.$api.student.studentBcFamily(this.xh).then(res => {
            this.familyList = res.data
          })
          this.$api.student.studentBcResume(this.xh).then(res => {
            this.resumeList = res.data
          })
        }
      },
      immediate: true
    }
  },
  computed: {
    ...mapState({
      TYPE0124: state => state.app['TYPE0124'] // 审核状态
    })
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  created () {
    this.$store.dispatch('app/setDictionary', 'TYPE0124')
  },
  methods: {
    audit () {
      this.form.validateFields((err, values) => {
        if (err) {
          return
        }
        this.$api.student.supplementCheck(Object.assign({xh: this.xh}, values, {explain: values.explain || ' '})).then(res => {
          this.$message.warning('操作成功')
          this.form.resetFields()
          this.$emit('supplement')
        })
      })
    },
    back () {
      this.$emit('supplement')
      this.$router.back()
      // this.$router.push(`/student/info/uncheckedList`)
      // this.form.resetFields()
      // this.$emit('showList')
    }
  }
}
</script>

<style>

</style>
